/*
 * @Author: your name
 * @Date: 2021-03-15 15:14:30
 * @LastEditTime: 2021-04-12 14:09:21
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \test\src\api\apply-info.js
 */
import request from '../utils/request'
import apiInfo from '../api/api-info'

// 注册用户
export function userRegister (val) {
  console.log('register', val)
  return request({
    url: apiInfo.register.url,
    data: val,
    method: 'post'
  })
}
// 登录用户
export function userLogin (val) {
  console.log('userLogin', val)
  return request({
    url: apiInfo.login.url,
    data: val,
    method: 'post'
  })
}
// 注销用户
export function userLoginOut () {
  console.log('userLoginOut')
  return request({
    url: apiInfo.loginOut.url,
    method: 'post'
  })
}
// 获取实时疫情getRealTimeData
export function getRealTimeData (val) {
  console.log('getRealTimeData')
  return request({
    url: apiInfo.getRealTimeData.url + val,
    method: 'get'
  })
}
// 删除用户
export function deleteUser (val) {
  console.log('deleteUser', val)
  return request({
    url: apiInfo.deleteUser.url + '/' + val,
    method: 'post'
  })
}
// 查询用户信息
export function getUserInfo (val) {
  console.log('user val', val)
  return request({
    url: apiInfo.getUserInfo.url,
    data: val,
    method: 'post'
  })
}
// 新增用户基础信息insertBaseInfo
export function insertBaseInfo (val) {
  console.log('insertBaseInfo val', val)
  return request({
    url: apiInfo.insertBaseInfo.url,
    data: val,
    method: 'post'
  })
}
// 查询用户基础信息
export function getUserBasicInfo (val) {
  return request({
    url: apiInfo.getUserBasicInfo.url + '/' + val,
    method: 'get'
  })
}
// 修改用户基础信息
export function updateBaseInfo (val) {
  return request({
    url: apiInfo.updateBaseInfo.url,
    data: val,
    method: 'post'
  })
}
// 修改用户密码
export function updateUser (val) {
  return request({
    url: apiInfo.updateUser.url,
    data: val,
    method: 'post'
  })
}
// 查询温度信息
export function getTemperatureInfo (val) {
  console.log('temperature val', val)
  return request({
    url: apiInfo.getTemperatureInfo.url,
    data: val,
    method: 'post'
  })
}

// 删除体温
export function deleteTemperature (val) {
  console.log('temperature val', val)
  return request({
    url: apiInfo.deleteTemperature.url + '/' + val.id,
    method: 'post'
  })
}
// 填报温度信息
export function insertTemperature (val) {
  console.log('insert val', val)
  return request({
    url: apiInfo.insertTemperature.url,
    params: {
      userId: val.userId,
      temperature: val.temperature
    },
    method: 'post'
  })
}
// 查询外出信息
export function queryOutRecords (val) {
  console.log('insert val', val)
  return request({
    url: apiInfo.queryOutRecords.url,
    data: val,
    method: 'post'
  })
}
// 判断是否体温正常或者高风险地区回归
export function homeQuarantineDay (val) {
  console.log('homeQuarantineDay val', val)
  return request({
    url: apiInfo.homeQuarantineDay.url + val,
    method: 'get'
  })
}
// 新增外出信息
export function insertOutRecord (val) {
  console.log('insert val', val)
  return request({
    url: apiInfo.insertOutRecord.url,
    data: val,
    method: 'post'
  })
}
// 删除外出信息
export function deleteOutRecord (val) {
  console.log('insert val', val)
  return request({
    url: apiInfo.deleteOutRecord.url + '/' + val,
    data: val,
    method: 'post'
  })
}
// 查询行程信息
export function queryRoutes (val) {
  console.log('queryRoutes val', val)
  return request({
    url: apiInfo.queryRoutes.url,
    data: val,
    method: 'post'
  })
}
// 新增行程信息
export function insertRoute (val) {
  console.log('insertRoute val', val)
  return request({
    url: apiInfo.insertRoute.url,
    data: val,
    method: 'post'
  })
}
// 删除行程信息
export function deleteRoute (val) {
  console.log('deleteRoute val', val)
  return request({
    url: apiInfo.deleteRoute.url + val,
    method: 'post'
  })
}
// 查询社区信息
export function queryAllCommunity () {
  return request({
    url: apiInfo.queryAllCommunity.url,
    method: 'get'
  })
}
// 修改社区信息
export function updateCommunity (val) {
  return request({
    url: apiInfo.updateCommunity.url,
    data: val,
    method: 'post'
  })
}
// 删除社区信息
export function deleteCommunity (val) {
  return request({
    url: apiInfo.deleteCommunity.url + val,
    method: 'post'
  })
}
// 新增社区信息
export function insertCommunity (val) {
  return request({
    url: apiInfo.insertCommunity.url,
    data: val,
    method: 'post'
  })
}
// 查询小区信息
export function queryEstateByCommunityId (val) {
  return request({
    url: apiInfo.queryEstateByCommunityId.url + val,
    method: 'get'
  })
}
// 新增小区信息
export function insertEstate (val) {
  return request({
    url: apiInfo.insertEstate.url,
    data: val,
    method: 'post'
  })
}
// 修改小区信息
export function updateEstate (val) {
  return request({
    url: apiInfo.updateEstate.url,
    data: val,
    method: 'post'
  })
}
// 删除小区信息
export function deleteEstate (val) {
  return request({
    url: apiInfo.deleteEstate.url + val,
    method: 'post'
  })
}
// 重新查询状态
export function getUserStates (val) {
  return request({
    url: apiInfo.getUserStates.url + val,
    method: 'get'
  })
}
// 获取异常用户信息
export function getBadStates (val) {
  return request({
    url: apiInfo.getBadStates.url,
    data: val,
    method: 'post'
  })
}
